/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.servicios;

import com.ec.socialfun.entidades.Ciudad;
import com.ec.socialfun.entidades.Zona;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author hp
 */
@Stateless
public class ZonaFacade extends AbstractFacade<Zona> {
    @PersistenceContext(unitName = "SocialFunPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ZonaFacade() {
        super(Zona.class);
    }
    
    public List<Zona> recuperaPorCiudad(Ciudad ciudad){
       Query q =  em.createNamedQuery("Zona.recuperarPorCiudad");
       q.setParameter("ciudad", ciudad);
       return q.getResultList();
    }
    
}
